function zeroes=geq_solver_ext(input,iota,mu,gamma_a,gamma_b,chi_b,rho_a,rho_b,phi,theta)

global eta lambda zeta
global chi_a
global nu
global epsilon beta delta delta_p
global Q alphah alphal mh ml
global ss

iah=input(1);
ial=input(2);
ibh=input(3);
ibl=input(4);
omegah=input(5);
omegal=input(6);
a=input(7);
v1h=input(8);
v1l=input(9);
nsa=input(10);
nsb=input(11);

nbah=alphah*(1-iah*Xa(omegah));
nbal=alphal*(1-ial*Xa(omegal));
nba=nbah+nbal;
nbbh=alphah*(1-ibh*Xb(omegah));
nbbl=alphal*(1-ibl*Xb(omegal));
nbb=nbbh+nbbl;

sigmaah=nbah/nba;
sigmaal=nbal/nba;
sigmabh=nbbh/nbb;
sigmabl=nbbl/nbb;
mba=phi*(nsa/nba)^nu;
msa=phi*(nba/nsa)^(1-nu);
mbb=phi*(nsb/nbb)^nu;
msb=phi*(nbb/nsb)^(1-nu);

auxh=(alphah*mh*a+alphal*ml)*(alphah*Q(1,1)+alphal*Q(2,1))/((alphah*mh+alphal*ml)*(alphah*Q(1,1)*a+alphal*Q(2,1)));
auxl=(alphah*mh*a+alphal*ml)*(alphal*Q(2,2)+alphah*Q(1,2))/((alphah*mh+alphal*ml)*(alphal*Q(2,2)+alphah*Q(1,2)*a));
gh=1+auxh*gamma_a*(iah*Xa(omegah)+(1-iah*Xa(omegah))*mba)+auxh*gamma_b*(ibh*Xb(omegah)+(1-ibh*Xb(omegah))*mbb);
gl=1+auxl*gamma_a*(ial*Xa(omegal)+(1-ial*Xa(omegal))*mba)+auxl*gamma_b*(ibl*Xb(omegal)+(1-ibl*Xb(omegal))*mbb);

g=gh*(alphah*Q(1,1)+alphal*Q(2,1)/a)/(alphah*Q(1,1)+alphal*Q(2,1));
r=beta/(g^(epsilon*zeta/(lambda+zeta)));
rt=1/r-1+delta;
A=zeta*(eta/rt)^(eta/(lambda+zeta))*(g*(alphah*mh+alphal*ml))^(-lambda/(lambda+zeta));

Bh=A*mh+r*(Q(1,1)*v1h+Q(1,2)*v1l)*g^(-lambda/(lambda+zeta));
Bl=A*ml+r*(Q(2,1)*v1h+Q(2,2)*v1l)*g^(-lambda/(lambda+zeta));
oa=(msa*theta*(sigmaah*Bh+sigmaal*Bl)*gamma_a)/(1-(1-msa*theta)*r*delta_p*g^(zeta/(lambda+zeta)));
ob=(msb*theta*(sigmabh*Bh+sigmabl*Bl)*gamma_b)/(1-(1-msb*theta)*r*delta_p*g^(zeta/(lambda+zeta)));

zeroes(1)=iah-((1/((1-ss)*chi_a))*(Xa(omegah)*((1-mba*(1-theta))*Bh*gamma_a+mba*(1-theta)*r*delta_p*oa*g^(zeta/(lambda+zeta)))+(1-Xa(omegah))*oa))^(1/rho_a);
zeroes(2)=ial-((1/((1-ss)*chi_a))*(Xa(omegal)*((1-mba*(1-theta))*Bl*gamma_a+mba*(1-theta)*r*delta_p*oa*g^(zeta/(lambda+zeta)))+(1-Xa(omegal))*oa))^(1/rho_a);
zeroes(3)=ibh-((1/((1-ss)*chi_b))*(Xb(omegah)*((1-mbb*(1-theta))*Bh*gamma_b+mbb*(1-theta)*r*delta_p*ob*g^(zeta/(lambda+zeta)))+(1-Xb(omegah))*ob))^(1/rho_b);
zeroes(4)=ibl-((1/((1-ss)*chi_b))*(Xb(omegal)*((1-mbb*(1-theta))*Bl*gamma_b+mbb*(1-theta)*r*delta_p*ob*g^(zeta/(lambda+zeta)))+(1-Xb(omegal))*ob))^(1/rho_b);
zeroes(5)=mu*omegah^iota-(iah*Xap(omegah)*((1-mba*(1-theta))*Bh*gamma_a+mba*(1-theta)*r*delta_p*oa*g^(zeta/(zeta+lambda))-oa))-(ibh*Xbp(omegah)*((1-mbb*(1-theta))*Bh*gamma_b+mbb*(1-theta)*r*delta_p*ob*g^(zeta/(zeta+lambda))-ob));
zeroes(6)=mu*omegal^iota-(ial*Xap(omegal)*((1-mba*(1-theta))*Bl*gamma_a+mba*(1-theta)*r*delta_p*oa*g^(zeta/(zeta+lambda))-oa))-(ibl*Xbp(omegal)*((1-mbb*(1-theta))*Bl*gamma_b+mbb*(1-theta)*r*delta_p*ob*g^(zeta/(zeta+lambda))-ob));
zeroes(7)=a-gh*(alphah*Q(1,1)*a+alphal*Q(2,1))*(alphal*Q(2,2)+alphah*Q(1,2))/(gl*(alphah*Q(1,1)+alphal*Q(2,1))*(alphal*Q(2,2)+alphah*Q(1,2)*a));
zeroes(8)=v1h-Bh;
zeroes(9)=v1l-Bl;
zeroes(10)=nsa-(alphah*iah*(1-Xa(omegah))+alphal*ial*(1-Xa(omegal)))/(1-delta_p*(1-msa));
zeroes(11)=nsb-(alphah*ibh*(1-Xb(omegah))+alphal*ibl*(1-Xb(omegal)))/(1-delta_p*(1-msb));


